home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Info-Mac 3
/
Info_Mac_1994-01.iso
/
Communications
/
Networks
/
MailCheck 0.9x
/
drvr src
/
mmc_os_preserve.c
< prev
next >
Wrap
Text File
|
1992-06-15
|
915b
|
47 lines
/*
* get/save resource manager state
*/
#define OSP_protected_call xOSP_protected_call
#include "mmc_os_preserve.h"
#undef OSP_protected_call
long OSP_protected_call(int new_heap,
long (*cproc)(long a1,long a2,long a3,long a4),
long a1,
long a2,
long a3,
long a4);
long OSP_protected_call(new_heap,cproc,a1,a2,a3,a4)
int new_heap;
long (*cproc)(long a1,long a2,long a3,long a4);
long a1,a2,a3,a4;
{
THz oldZone;
long result;
ProcPtr old_res_err=ResErrProc;
int old_err_num=ResErr;
int old_load;
asm {
bra.s @skip_rts
new_err_proc:
rts
skip_rts:
lea @new_err_proc,a0
move.l a0,ResErrProc
}
oldZone = GetZone();
if((new_heap&OSP_sys)!=0)
SetZone(SystemZone());
old_load=ResLoad;
SetResLoad(((new_heap&OSP_noload)==0));
result=(*cproc)(a1,a2,a3,a4);
SetResLoad(old_load);
if((new_heap&OSP_sys)!=0)
SetZone(oldZone);
ResErrProc=old_res_err;
ResErr=old_err_num;
return result;
}